package com.lb.hash;

import javax.xml.bind.DatatypeConverter;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * @author: zhangjun
 * @date: 2024/10/17
 */
public class HashTest {
    public static void main(String[] args) throws NoSuchAlgorithmException {
        MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
        byte[] bytes = "hello".getBytes();
        byte[] digest = messageDigest.digest(bytes);
        String s = DatatypeConverter.printHexBinary(digest);
        System.out.println(s);
        System.out.println("hello".hashCode());
    }
}
